package pub.cleangao.memm.transport.netty.serialize;

import java.util.HashMap;
import java.util.Map;

public class SerializerSupplier {

    private static final Map<String, Serializer> serializerMap = new HashMap<>();

    static {
        HessianSerializer hessianSerializer = new HessianSerializer();
        serializerMap.put(hessianSerializer.key(), hessianSerializer);
        KryoSerializer kryoSerializer = new KryoSerializer();
        serializerMap.put(kryoSerializer.key(), kryoSerializer);
        ProtostuffSerializer protostuffSerializer = new ProtostuffSerializer();
        serializerMap.put(protostuffSerializer.key(), protostuffSerializer);
    }

    public static Serializer getByType(String type) {
        return serializerMap.get(type);
    }

}
